﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace mysecondlib
{
    public partial class Form1 : Form
    {
        //public EventHandler<bool> abc();
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Test1 t1 = new Test1();
            GetOutput<Test1>(t1);
            Form f = new Form();
            //f.Show();
            f.ShowDialog();
        }

        /*
         * This function is to test "where" keyword with new()
         * */
        public void GetOutput<T>(T t) where T : parentTest, new()
        {
            t.output();
            //if (t is Test1)
            //{
            //    (t as Test1).output();
            //}
            //else if (t is Test2)
            //{
            //    (t as Test2).output();
            //}
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.DoEvents();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            hpShell.SetShowHelp(this, true);
            hpShell.HelpNamespace = "mspaint.chm";
        }
    }
}
